package demo1;

public class Test2 {
    public static void main(String[] args) {
        int[] A = {4,5,6,0,0,0};
        int[] B = {1,2,3};
        merge(A,3,B,3);
        for (int i = 0; i < A.length; i++) {
            System.out.print(A[i] + ",");
        }
    }
    public static void merge(int A[], int m, int B[], int n) {
        int a = m;
        while (a < m + n) {
            A[a] = B[a-3];
            a++;
        }
        for (int i = 0; i < m + n - 1; i++) {  // i < 5
            for (int j = 0; j < m + n - i -1; j++) {  // j < 5
                if (A[j] > A[j+1]) {
                    int temp = A[j];
                    A[j] = A[j+1];
                    A[j+1] = temp;
                }
            }
        }

    }
}
